<?php include 'header.php';?>
<body>
<table class="layui-table">
	<thead>
		<tr>
        <td>ID</td>
        <td>用户</td>
        <td>评论内容</td>
        <td>IP</td>
        <td>时间</td>
		<td>操作</td>
		</tr>
    </thead>
    <?php
    $data = $this->db
    		->join('as a left join '.sc('db', 'pre').'members as b on a.comments_uid = b.u_id')
    		->order('a.comments_id desc')
    		->page(12)
    		->fetchAll('a.comments_id, a.comments_uid, a.comments_contents, a.comments_ip, a.comments_date, b.u_nickname');
    foreach($data[0] as $rows){
    ?>
    <tr id="grace-item-<?php echo $rows['comments_id'];?>">
		<td>
			<?php echo $rows['comments_id'];?>
		</td>
		<td>
			<?php echo $rows['u_nickname'];?>
		</td>
		<td>
			<?php echo $rows['comments_contents'];?>
		</td>
		<td>
			<?php echo $rows['comments_ip'];?>
		</td>
		<td>
			<?php echo date('Y-m-d H:i:s', $rows['comments_date']);?>
		</td>
        <td class="layui-operate-td">
            <a href="javascript:graceDelete('<?php echo u(PG_C, 'delete', $rows[$this->tableKey]);?>', '#grace-item-<?php echo $rows[$this->tableKey];?>');">
            	<i class="layui-icon">&#xe640;</i> 删除
            </a>
        </td>
    </tr>
    <?php
    }
    ?>
</table>
<div>
	<a href="javascript:location.href=location.href;" class="layui-btn layui-btn-normal"><i class="layui-icon">&#xe666;</i> 刷新数据</a>
	<?php $this->showPager($data[1]);?>
</div>
</body>
</html>